﻿@inherits UmbracoTemplatePage
@{
    
    Layout = "WithoutSiderbar.cshtml";
    IPublishedContent root = Model.Content;
    if (!root.DocumentTypeAlias.Equals("consultingIndex"))
    {
        root = Model.Content.AncestorsOrSelf("consultingIndex").FirstOrDefault();
    }
    string keyword = string.Empty;
    if (Request.QueryString["keyword"] != null)
    {
        keyword = Server.UrlDecode(Request.QueryString["keyword"]);
    }

    var consults = Model.Content.Descendants("consultingDetail").Where(x => x.IsVisible() && !x.GetPropertyValue<bool>("umbracoNaviHide"));
    if (!string.IsNullOrEmpty(keyword))
    {

    }
}

<div class="pull-right"><a type="button" class="btn btn-success" href="/consulting/create">我要提问</a></div>

@Html.Partial("RenderConsultFilter")

<div class="consulting-list">
    <div class="consulting-heading">
        <div class="topic">标题</div>
        <div class="category">所属分类</div>
    </div>
    <ul>
        @foreach (var item in consults)
        {
            <li>
                <div class="topic">
                    <h4><a href="@item.Url">@item.Name：</a></h4>
                    <div class="time-info">
                        @UtilTool.HideIp(item.GetPropertyValue<string>("ip"))
                        创建于：@UtilTool.ConvertShortTime(item.GetPropertyValue<string>("addingTime"))，
                        回复于：@item.UpdateDate.ToString("yyyy-MM-dd HH:mm") 
                    </div>
                </div>
                <div class="category"><p class="bg-primary"><a href="@item.Parent.Url">@item.Parent.Name</a></p></div>
            </li>
        }
    </ul>
</div>

@Html.Partial("RenderPagination", Model.Content, new ViewDataDictionary { { "count", consults.Count() } })